package com.link2room.optimus.entity;

import com.link2room.common.entity.BaseEntity;
import org.hibernate.annotations.DynamicInsert;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;

/**
 * 基础日历
 * Created by sss on 2016/8/25.
 */
@Entity
@Table(name = "base_calendar", catalog = "")
@DynamicInsert
public class BaseCalendar extends BaseEntity{
    public enum BaseCalendar_{
        date,weekd,level
    }

    /**
     * 日期
     */
    private Date date;
    /**
     * 星期
     */
    private Integer weekd;
    /**
     * 优先级
     */
    private Integer level;

    @Basic
    @Column(name = "date", nullable = false)
    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    @Basic
    @Column(name = "weekd", nullable = true)
    public Integer getWeekd() {
        return weekd;
    }

    public void setWeekd(Integer weekd) {
        this.weekd = weekd;
    }

    @Basic
    @Column(name = "level", nullable = true)
    public Integer getLevel() {
        return level;
    }

    public void setLevel(Integer level) {
        this.level = level;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        BaseCalendar that = (BaseCalendar) o;

        if (date != null ? !date.equals(that.date) : that.date != null) return false;
        if (weekd != null ? !weekd.equals(that.weekd) : that.weekd != null) return false;
        if (level != null ? !level.equals(that.level) : that.level != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = date != null ? date.hashCode() : 0;
        result = 31 * result + (weekd != null ? weekd.hashCode() : 0);
        result = 31 * result + (level != null ? level.hashCode() : 0);
        return result;
    }
}
